﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.ServiceModel;
using System.Text;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;

namespace WCFServer
{
    class Server
    {
        static void Main(string[] args )
        {
            var configPath = //Path.Combine(System.Environment.CurrentDirectory,
                String.Format("{0}.config",
                              Path.GetFullPath(System.Environment.CommandLine.Trim().Replace("\"", "")));
            ISessionFactory sessionFactory = new Configuration().Configure(configPath).BuildSessionFactory();
            SchemaExport schemaExport = new SchemaExport(new Configuration().Configure(configPath));
            schemaExport.Create(true,true);
            ServiceHost serviceHost = new ServiceHost(
                typeof(ObjectDBService));
            serviceHost.Open();
            Console.WriteLine("Strated!");
            Console.ReadLine();
            serviceHost.Close();
            Console.WriteLine("Stopped!");
        }
    }
}
